In designing computer programs or other code modules, it is desirable to provide resources to the program that are linked with the program dynamically, as the program is executed. Providing these resources dynamically allows the code modules to be written in more general terms and then tailored to specific environments by varying the resources provided at run-time.
One popular way to provide these resources is by using a Dynamic Linked Library (DLL). A DLL is a collection of resources, each resource having an associated resource identifier. When a developer writes a code module, the developer can identify the desired resource to include by using the resource identifier. Later on, when the code module is executed, the computer system uses the resource identifier to locate the resource contained in the DLL, and then uses the located resource in the operation of the code module. Where it is desirable to vary the resource, only the DLL containing the startup screen resource need be changed. For example if the resource is a startup screen and different vendors wish to display different startup screens when the code module is executed, then each vendor will supply a different startup screen image, but the image will be linked to the same resource identifier. Thus, when the code module executes, it will load a vendor-specific startup screen.
One conventional method of organizing resources into DLLs is to create a separate DLL for each code module, the DLL containing all of the resources that the code module needs to properly execute. This method is inefficient, however, in cases where many of the resources are common to multiple code modules. These common resources are duplicated across many DLLs, which leads to many extra copies of the same resource being present throughout the various DLLs resident in the computer system. This massive duplication of resources is wasteful of storage space and leads to bloated software.
One solution to this problem is to providing multiple DLLs for each code module to access. Resources specific to a particular code module are placed into an application-specific DLL, and shared resources are placed into a shared DLL. Additional DLLs may be created as needed, for example to implement bug fixes or to allow for vendor or customer customization of the code module's resources. Each code module therefore can access several different DLLs.
A drawback to this solution, however, is that the code module needs some way of figuring out which DLL it should access when looking for a resource. The code module cannot easily discern which DLL to use. For example, it is common for a manufacturer of a code module to provide a base DLL that contains default resources. A middleman such as a distributor or vendor of the code module may also supply a DLL containing other resources, possible including some resources associated with the same resource identifiers as used in the base DLL. A purchaser of the code module may also create a custom-designed DLL containing yet other resources, possibly including resources associated with the same resource identifiers as used in the other DLLs. If all three of these DLLs are present when the software executes, then the code module needs some way of determining which DLL to access.
One solution to this dilemma is to write customized selection code that tells the code module which DLL to use. Each time the code module makes a call to a resource identifier, the call is passed through the customized selection code to determine which DLL to use. The customized selection code contains program logic provided by the various DLL suppliers, which helps determine which DLL to use. This program logic, however, has to be modified and updated each time a DLL is added or removed from the computer system. These modifications increase computer overhead and lead to inefficient use of computer resources.
Thus, an apparatus and method is needed to allow resources to be flexibly stored and easily maintained, without requiring modifications to program logic, while minimizing the storage space consumed by the resources.